home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor1 / getkey.doc < prev    next >
Text File  |  1995-03-31  |  2KB  |  46 lines

  1. GETKEY, by Joseph K. Horn 
  2.  
  3. Here's a useful utility for fetching a single key definition, very 
  4. much like FETCH KEY on the HP-75 and HP-71. 
  5.  
  6. The following RPL routine works instantly.  Shifted, alpha, and 
  7. shifted alpha keys all work.  The only key it won't fetch is ATTN, 
  8. which is used to exit the program if desired. 
  9.  
  10. INSTRUCTIONS:  Run it, then press any key.  Its definition will be 
  11. recalled to the stack, with its keycode above it.  Since it gives no 
  12. indication that it's running, do not include it in programs; only 
  13. use it from the keyboard. 
  14.  
  15. It is most useful when assigned to a key; fetching a key definition 
  16. only takes two keystrokes then.  I keep it assigned to the Equation 
  17. Writer key (which won't be useful until Version HP48-F). 
  18.  
  19. RPL listing of GETKEY: 
  20.  
  21. 02D9D Begin program object 
  22. 2A2B4 0; for 0 WAIT construct 
  23. 1A738 Internal WAIT; pause until key press; return rc.p keycode 
  24. 03188 Internal DUP; float keycode until the end 
  25. 41CA2 Convert rc.p keycode into <key> <plane> system keycodes 
  26. 41F3F Recall contents of UserKeys var to the stack 
  27. 03295 Internal ROT --> { UserKeys } <key> 
  28. 056B6 Internal GET --> { all 6 definitions on that key } True 
  29. 03244 Internal DROP; lose the True 
  30. 63A6F Is the list empty? If so, push a True 
  31. 6191F If True, DROP2, do next, and end; else skip next 
  32. 6577B "Undefined"; the entire key is undefined; say so & stop 
  33. 03223 Internal SWAP --> { the key's 6 definitions } <plane> 
  34. 056B6 Internal GET --> either the definition or { }, and True 
  35. 03244 Internal DROP; lose the True 
  36. 63A6F Is the list empty? If so, push a True 
  37. 618F7 If True, DROP, do next, and end; else skip next 
  38. 6577B "Undefined"; that key is undefined; say so & stop 
  39. 0312B End program; exit with keycode floating above definition. 
  40.  
  41. Bytes: 47.5; Checksum: # E49Dh. 
  42.  
  43. Thanks to Rick Grevelle and Derek Nickel who made this possible. 
  44.  
  45. -- Joseph K. Horn -- Peripheral Vision, Ltd. -- 
  46.